#pragma once

#include <func.h>
#include "serve.h"

#define N 30

typedef struct man E;

typedef struct
{
    E* elements[N];
    int front;
    int rear;
    int size;
    pthread_mutex_t mutex;
    pthread_cond_t not_empty;
    pthread_cond_t not_full;
} BlockQ;

BlockQ* blockq_create(void);
void blockq_destroy(BlockQ* q);
bool blockq_empty(BlockQ* q);
bool blockq_full(BlockQ* q);
void blockq_push(BlockQ* q, E* val);
E* blockq_pop(BlockQ* q);
E* blockq_peek(BlockQ* q);
